package com.tch.async;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 *  异步代理类 - 需要结合线程池
 */
@Component
@Slf4j
public class MemberServiceAsync {
    /**
     * taskExecutor 指定线程池名称
     * @return
     */
    @Async("taskExecutor")
    public String sms(){
        log.info(">02<");
        log.info(">短信发送中。。。<");
        try {
            Thread.sleep(3000);
        } catch (Exception e) {
            e.printStackTrace();
        }
        log.info(">03<");
        return "短息发送";
    }
}
